FROM python:3.7-alpine

RUN sed -i 's#https://dl-cdn.alpinelinux.org/#http://mirrors.ustc.edu.cn/#g' /etc/apk/repositories
RUN apk update \
  && apk --update add --no-cache gcc \
  && apk --update add --no-cache git \
  && apk --update add --no-cache g++ \
  && apk --update add --no-cache tzdata \
  && apk --update add --no-cache libffi-dev \
  && apk --update add --no-cache libxslt-dev \
  && apk --update add --no-cache jpeg-dev


ENV  TIME_ZONE Asia/Shanghai
ENV PIPURL "https://pypi.tuna.tsinghua.edu.cn/simple"


RUN echo "${TIME_ZONE}" > /etc/timezone \
  && ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime

COPY . /app
WORKDIR /app

RUN pip --no-cache-dir install  -i ${PIPURL} --upgrade pip \
  && pip --no-cache-dir install  -i ${PIPURL} -r requirements.txt
CMD ["flask", "run"]